@extends('admin_system/public/angular-layout')
<body ng-app="admin-app" ng-controller="chapterController">
<div class="main-container" data-ng-init="get_officerInfo()">

    {{--顶部导航--}}
    <div class="col-xs-12 top-nav nav">
        <p class="float-left nav-path"><strong>当前位置：</strong>分会管理>>添加、编辑学习官</p>

        {{--返回按钮--}}
        <button type="button" class="btn btn-default float-right back" aria-label="Left Align">
            <span class="glyphicon glyphicon-arrow-left back" aria-hidden="true"></span>
            <span>返回</span>
        </button>
    </div>

    <div class="h10 col-xs-12"></div>

    {{--正文内容--}}
    <div class="content-box col-xs-12 mt20 pb20 pt20">
        <form class="col-xs-4" style="min-width: 300px;" action="{{asset('/admin_system/chapter/update_prisident')}}" method="post" enctype="multipart/form-data">
            <div class="form-group">
                <label>分会名称：</label>
                <input  class="form-control" ng-model="officerInfo.chapterName" disabled>
            </div>

            <div class="form-group">
                <label>学习官：</label>
                <input class="form-control" ng-model="officerInfo.YourName" readonly onclick="$('#model').modal('show');" id="prisidentName">
                <input style="position: fixed;left:-200vw;" ng-model="officerInfo.UserID" id="prisidentId">
            </div>


            <div class="form-group">
                <label>总金额：</label>
                <input name="total_money" class="form-control" ng-model="officerInfo.total_money" required>
            </div>

            <div class="form-group">
                <label>已支付金额：</label>
                <input name="payed_money" class="form-control" ng-model="officerInfo.payed_money" required>
            </div>

            <div class="form-group">
                <label>剩余金额：</label>
                <input name="surplus_money" class="form-control" ng-model="officerInfo.surplus_money" required>
            </div>

            <span  class="btn btn-primary" ng-click="update_officer_info()">提交</span>
        </form>
    </div>

    <div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel" id="model">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">

                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="gridSystemModalLabel">选择用户</h4>
                </div>


                <div class="modal-body">
                    <iframe src="{{asset('admin_system/member/select_member?callback=receive_member')}}" frameborder="0" style="width:100%;height:80vh;"></iframe>
                </div>
            </div>
        </div>
    </div>


    <script>
        function receive_member(members){

            $('#model').modal('hide');console.log(members);
            var length = members.length;
            for(var i=0;i<length;i++)
            {
                var member = members[i];
                $('#prisidentName').val(member.name);
                $('#prisidentId').val(member.id);

                var input = angular.element($('#prisidentId'));
                var scope = input.scope();
                scope.value=member.id;
                scope.$apply();

                var input1 = angular.element($('#prisidentName'));
                var scope1 = input1.scope();
                scope1.value=member.name;
                scope1.$apply();

                //$('#prisidentId').trigger('input');
                //$('#prisidentId').trigger('change');
                //$('#prisidentName').trigger('input');
                //$('#prisidentName').trigger('change');
                break;
            }

        }
    </script>
</div>
</body>

